<?php

function update_exists($tablename,$exists_name,$exists_type = 1){  //表名  字段名字   字段类型  1.varchar 2.int 3.text   后期慢慢添加
	
	
	$field = mysql_query("Describe $tablename $exists_name");
	$field = mysql_fetch_array($field);
	
	if($exists_type == 1){
		$type = " VARCHAR( 255 ) NOT NULL ";
	}
	elseif($exists_type == 2){
		$type = " INT( 11 ) NOT NULL DEFAULT '0' ";
	}
	elseif($exists_type == 3){
		$type = " TEXT NOT NULL ";
	}
	
	if($field[0]){
		
	}
	else{
		$sql = 'ALTER TABLE '.$tablename.' ADD '.$exists_name.$type;
		mysql_query($sql);
	} 
	
}